/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.lfu.test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
 
public class Main {
 
	/**
	 * @author FP
	 */
	class Node implements Comparable<Node>{
		public int value;
		public String NodeNum;
		public Node(int v,String s){
			value = v;
			NodeNum =s;
		}
		@Override
		public int compareTo(Node arg0) {//实现compareTo
			// TODO Auto-generated method stub
			if(value<arg0.value){
				return -1;
			}else if (value==arg0.value) {
				return 0;
			}else {
				return 1;
			}
		}
		@Override
		public String toString(){//重写本类对象的标准化输出
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.append(value+"  ");
			stringBuilder.append(NodeNum);
			return stringBuilder.toString();
		}
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Node n1 = new Main().new Node(3,"num1");
		Node n2 = new Main().new Node(1,"num2");
		Node n3 = new Main().new Node(6,"num3");
		Node n4 = new Main().new Node(5,"num5");
		Node n5 = new Main().new Node(2,"num2");
		Node n6 = new Main().new Node(9,"num9");
		Node n7 = new Main().new Node(8,"num8");
		List<Node> nodeList= new ArrayList<Node>(Arrays.asList(n1,n2,n3,n4,n5,n6,n7));
		Collections.sort(nodeList);
		System.out.println(nodeList);	
	}
}